/********************************************************************************
 *      Copyright:  (C) 2025 LingYun<iot25@lingyun>
 *                  All rights reserved.
 *
 *       Filename:  main.h
 *    Description:  This file 
 *
 *        Version:  1.0.0(24/04/25)
 *         Author:  LingYun <iot25@lingyun>
 *      ChangeLog:  1, Release initial version on "24/04/25 15:13:13"
 *                 
 ********************************************************************************/

#ifndef ___MAIN_H_
#define ___MAIN_H_

#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#include <arpa/inet.h>
#include <errno.h>
#include <unistd.h>
#include <getopt.h>
#include <stdlib.h>
#include <dirent.h>
#include <signal.h>
#include <time.h>
#include <sqlite3.h>

#define DEFAULT_REPORT_INTERVAL 1800  // 30分钟，单位：秒
#define DEFAULT_SERVER_IP "127.0.0.1"
#define DEFAULT_SERVER_PORT 8888
#define DEVICE_SN "DS18B20-001"
#define DB_PATH "./temp_data.db"


typedef struct client_ctx_s {
    char server_ip[32];
    int server_port;
    int report_interval;
    int is_running;
    int sockfd;
    sqlite3 *db;
} client_ctx_t;

// 全局变量
extern client_ctx_t g_client_ctx;



void print_usage(char *progname);
void signal_handler(int signo);


#endif

